#!/usr/bin/python3

from tkinter import *
from tkinter import ttk

class App():
    def __init__(self):
        self.root = Tk()

    def addPhoto(self):
        self.photo=PhotoImage(file='example.gif')

    def show(self):
        self.text.image_create(END, image=self.photo)
        

    def addText(self):
        self.text = Text(self.root, width=30, height=10)
        self.text.pack()

        self.text.insert(INSERT, "I love CW")

    def addButton(self):
        self.button = Button(self.text, text='click', command=self.show)
        self.text.window_create(INSERT, window=self.button)

    def run(self):
        self.addText()
        self.addPhoto()
        self.addButton()
        self.root.mainloop()

if __name__ == "__main__":
    app = App()
    app.run()
